package com.woniuxy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.mapper.HospitalMapper;
import com.woniuxy.pojo.Hospital;
import com.woniuxy.service.HospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author admin
* @description 针对表【hospital(医院表（合并总院和分店）)】的数据库操作Service实现
* @createDate 2025-05-30 10:58:40
*/
@Service
public class HospitalServiceImpl extends ServiceImpl<HospitalMapper, Hospital>
    implements HospitalService {

    @Autowired
    private HospitalMapper hospitalMapper;
    @Override
    public List<String> getHospital() {
        QueryWrapper<Hospital> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("DISTINCT name");
        List<Hospital> hospitals = hospitalMapper.selectList(queryWrapper);
        return hospitals.stream().map(Hospital::getName).collect(Collectors.toList());
    }
}




